package com.hzqy.service.industry.medical;

import com.hzqy.persistence.dao.industry.SdGoodDao;
import com.hzqy.web.vo.industry.medical.SdGoodOrderVo;
import com.hzqy.web.vo.industry.medical.SdGoodSysBrand;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class SdgoodService {
    protected final Logger LOG = LoggerFactory.getLogger(getClass());
    
    @Resource
    private SdGoodDao sdGoodDao;
    
    public Map<String, Object> selectSys() {
        LOG.debug("selectSys: 16行");
        Map<String,Object> resultMap =new HashMap<>();
        List<SdGoodSysBrand> list = sdGoodDao.selectSys();
        if (list==null||list.size()==0){
            resultMap.put("success",false);
            resultMap.put("message","查询失败");
        }else {
            resultMap.put("data",list);
            resultMap.put("success",true);
            resultMap.put("message","查询成功");
        }
        LOG.debug("selectSys: "+resultMap.get("message")+" 34行");
        return resultMap;
    }
    
    public Map<String, Object> selectGoods(String sys) {
        LOG.debug("selectSys: 39行");
        SdGoodSysBrand sdGoodSysBrand=new SdGoodSysBrand();
        sdGoodSysBrand.setF_sd_sys(sys);
        Map<String,Object> resultMap =new HashMap<>();
        List<SdGoodSysBrand> list = sdGoodDao.selectGoods(sdGoodSysBrand);
        if (list==null||list.size()==0){
            resultMap.put("success",false);
            resultMap.put("message","查询失败");
        }else {
            resultMap.put("data",list);
            resultMap.put("success",true);
            resultMap.put("message","查询成功");
        }
        LOG.debug("selectSys: "+resultMap.get("message")+" 52行");
        return resultMap;
    }
    
    public Map<String, Object> selectBrands(String good,String sys) {
        LOG.debug("selectSys: 57行");
        SdGoodSysBrand sdGoodSysBrand=new SdGoodSysBrand();
        sdGoodSysBrand.setF_sd_good(good);
        sdGoodSysBrand.setF_sd_sys(sys);
        Map<String,Object> resultMap =new HashMap<>();
        List<SdGoodSysBrand> list = sdGoodDao.selectBrands(sdGoodSysBrand);
        if (list==null||list.size()==0){
            resultMap.put("success",false);
            resultMap.put("message","查询失败");
        }else {
            resultMap.put("data",list);
            resultMap.put("success",true);
            resultMap.put("message","查询成功");
        }
        LOG.debug("selectSys: "+resultMap.get("message")+" 71行");
        return resultMap;
    }
}
